//
//  TableViewController.m
//  11212团购
//
//  Created by student on 16/3/7.
//  Copyright © 2016年 niit. All rights reserved.
//

#import "TableViewController.h"
#import "TgModel.h"
#import "TuanGouTableViewCell.h"

@interface TableViewController ()

@property(nonatomic,strong)NSMutableArray *list;

@end

@implementation TableViewController

- (NSArray *)list
{
    if(_list == nil)
    {
        _list = [TgModel tgList];
    }
    return _list;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    // Uncomment the following line to preserve selection between presentations.
    // self.clearsSelectionOnViewWillAppear = NO;
    
    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.list.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
   TuanGouTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
    
 
    TgModel *m = self.list[indexPath.row];
    cell.tg = m;
    
    return cell;
}



@end
